<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.fick.hibernate.model.*"%>
<%@ page import="com.fick.hibernate.dao.*"%>
<%@page import="java.util.List"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>河南省公安厅</title>
<link href="images/jiahao.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/check.js"></script>
<script type="text/javascript">
<!--
			    function CheckForm() {
					if(document.form1.webName.value=="")
					{
						alert("网址名字不能为空");
						document.form1.webName.focus();
						return false;
					}
					if(document.form1.webURL.value=="")
					{
						alert("网址URL不能为空");
						document.form1.webURL.focus();
						return false;
					}
					if(form1.pics!=null && form1.pics.value==""){
						alert("请上传图片");
						form1.pics.focus();
						return false;
					}
					if(form1.linkOrder.value!="" && form1.linkOrder.value!="0" && !isInt(form1.linkOrder.value,false)){
						alert("请输入正确的顺序!");
						form1.linkOrder.focus();
						return false;
					}
				}
//-->
</script>
</head>

<body>
<%
String type=request.getParameter("type");
String typeStr="文字";
if(type!=null && type.equals("2"))
	typeStr="图片";
if(type!=null && type.equals("3"))
	typeStr="下拉";
%>
<table width="100%"  height="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100%" align="center" valign="top" background="images/main_bj.gif" bgcolor="#FBFCFD"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="23" align="left" valign="middle" background="images/main_top.gif"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="20" height="23">&nbsp;</td>
            <td width="400" height="23" align="left" valign="middle" class="ts_lmdh2">添加<%=typeStr %>链接</td>
          </tr>
        </table></td>
      </tr>
    </table>
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="20"></td>
        </tr>
      </table>
	  
	  
	  
<form name="form1" id="form1" action="<%=request.getContextPath()%>/admin/managerLink.do?method=addLink" enctype="MULTIPART/FORM-DATA" method="post" onSubmit="return CheckForm();" />
     <input type="hidden" value="<%=type %>" name="type"/>
      <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D7DFE1">
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">网址名：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="webName"  size="30" value=""  type="text" class="ts_box3"/>
		  </td>
        </tr>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">网址url：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="webURL" id="webURL" size="30" value=""  type="text" class="ts_box3"/>
		  </td>
        </tr>
		<%if(!type.equals("3")){%>
	      <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">所属分类：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <select name="classid">
		  		<option value="0">请选择</option>
		  		<%
		  		//链接分类 
		  		LinkClassDAO linkClassDAO=new LinkClassDAO();
		  		List list=linkClassDAO.findAll();
		  		if(list!=null && list.size()>0){
		  			LinkClass linkClass;
		  			for(int i=0;i<list.size();i++){
		  				linkClass=(LinkClass)list.get(i);
		  				%>
		  			<option value="<%=linkClass.getClassid() %>"><%=linkClass.getClassName() %></option>
		  				<%
		  			}
		  		}
		  		%>
		  </select>
		  </td>
		<%} %>
        </tr>
       <%
       if(type!=null && type.equals("2")){
    	   //图片链接显示添加图片
    	   %>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">图片：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input type="file" name="pics" id="pics" value="" type="text" class="ts_box3"/>
		  </td>
        </tr>
    	   <%
       }
       %>
	  <%if(type!=null && type.equals("3"))
	  	{  
	  		//如果是下接链接的话显示上级联接
	  		%>
	  		<tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">上级联接</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <select name="paraid">
		  		<option value="0">请选择</option>
		  		<%
		  		//链接分类 
		  		LinkDAO  linkDAO2=new LinkDAO();
		  		List xllist=linkDAO2.findByHql(" where isPic=3 and paraid.linkid is null");
		  		if(xllist!=null && xllist.size()>0){
		  			Link link;
		  			for(int i=0;i<xllist.size();i++){
		  				link=(Link)xllist.get(i);
		  				%>
		  			<option value="<%=link.getLinkid()%>"><%=link.getWebName()%></option>
		  				<%
		  			}
		  		}
		  		%>
		  </select>
		  </td>
        </tr>
		<%
	  	}
	  %>
        <tr>
          <td width="30%" height="25" align="right" valign="middle" bgcolor="#FFFFFF">顺序：</td>
          <td height="25" align="left" valign="middle" bgcolor="#FFFFFF" style="padding-left:7px">
		  <input name="linkOrder" id="linkOrder" size="30" value=""  type="text" class="ts_box3" maxlength="4"/>
		  </td>
        </tr>
        <tr>
          <td height="30" colspan="2" align="center" valign="middle" bgcolor="#FFFFFF">
		  <input type="submit" name="Submit" value="添加">
		  <input  type="button" value="返回" onClick="javascript:history.go(-1);">
		  </td>
        </tr>
      </table>
</form>	  
	  
	  
	  
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="45" align="center" valign="middle">&nbsp;</td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
